The present invention relates to a method of locating highly variable brightness or colour regions in an image.
Systems are known for locating optical codes applied to objects moving along conveying devices (e.g. conveyor belts), and for determining the presence and space disposition of the code. As is known optical codes (e.g. bar codes, two-dimensional codes, etc.) are defined by a number of two-dimensional elements of given shape, of different colours (e.g. black/white or variously coloured elements), and arranged in a precise geometric order.
Some known locating systems use optical sensors (in particular television cameras) for picking up a two-dimensional image of the objects and selecting from the image an image portion corresponding to the optical code. Such systems also read the code contained in the selected image portion and extract the alphanumeric information of the code.
The image picked up by the camera normally includes a background in which are distinguishable a number of relevant regions varying considerably in brightness or colour and which correspond to optical code images, to graphically defined portions (e.g. tables or matrixes, labels and geometrically defined structures) and to alphanumeric signs automatically or manually impressed and arranged in orderly manner (e.g. aligned in rows).
Other known systems provide solely for locating in the image any specifically ordered regions corresponding, for example, to an optical code. In particular, systems are known for extracting from the image a subimage corresponding to the optical code.
Aim of the present invention is to provide a method of locating, in an image of the above said type, any relevant highly variable brightness or colour region, regardless of whether an optical code is included in the image or not. More specifically, aim of the present invention is to eliminate from the image any relevant specifically ordered regions (normally corresponding to optical code images or geometrically defined structures), by locating relevant regions of a different order from the relevant specifically ordered regions.
According to the present invention, there is provided a method of locating highly variable brightness or colour regions in an acquired image, wherein said image has a number of relevant regions, including: at least one specifically ordered region and at least one highly variable brightness region; the order level of said highly variable brightness or colour region differing from the order of the specifically ordered region; characterized by comprising the steps of: performing a first processing step of said image to generate a first intermediate binary image representing the acquired image divided into a number of contiguous first subimages, each having a first logic value if corresponding to a detected specifically ordered region, and a second logic value if corresponding to a region of the image other than said specifically ordered region; performing a second processing step of said acquired image to generate a second intermediate binary image representing the image divided into a number of contiguous second subimages, each having a first logic value if corresponding to a detected said specifically ordered region or a detected highly variable brightness region, and a second logic value otherwise; subtracting the first intermediate binary image from the second intermediate binary image to generate an output binary image defined by a number of contiguous subimages having said first logic value only at said highly variable brightness or colour regions of an order other than that of the specifically ordered regions, and said second logic value elsewhere.
More specifically, said first processing step of said acquired image comprises the steps of: calculating a number of gradient vectors for a number of elementary images into which said image is divided; determining significant gradient of an amplitude above a threshold value; assigning said first logic value to the first subimages containing significant gradient vectors with said predetermined orientation; assigning said second logic value to the first subimages containing significant gradient vectors with an orientation other than said predetermined orientation; and assigning said second logic value to the first subimages containing nonsignificant gradient vectors; said second processing step of said acquired image comprises the steps of; calculating a number of gradient vectors for a number of elementary images into which said image is divided; determining significant gradients of an amplitude above a threshold value; assigning said first logic value to the second subimages containing significant gradient vectors; assigning said second logic value to the second subimages containing nonsignificant gradient vectors.